/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __DATA_STRUCT_STACK_H__
#define __DATA_STRUCT_STACK_H__

#include "../tools/head.h"

namespace xos_http
{
    class module;
    class task;

    class stack : public xos_stl::mem_item< xos::release_impl<stack>, thread_lock >,
        public xos::i_release
    {
    public:
        typedef std::list< std::string > STR_LIST;
        typedef xos::release_impl<stack> T;

    public:
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // 
        static int get_xos_item_data( ITEM_DATA*& item_ptr );

    public:
        stack();
        ~stack();

    public:
        int push( task * pTask );
        int pop();

    public:
        STR_LIST::iterator m_uri_list_iter;
        STR_LIST m_uri_list;

        http::i_servlet * m_pServlet;
        module * m_pModule;

        task * m_pTask;
        int m_nTaskState;

    protected:
        int init_data();
        
    public:
        int init();
        int term();
        
    };

} // xos_http

#endif // __DATA_STRUCT_STACK_H__
